package com.ds.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class AnnoAop {
    public static final Logger log = LoggerFactory.getLogger(AnnoAop.class);
    long st;
    long ed;
    @Before("execution(* com.ds.service.*Impl.*(..))")
    public void before() throws Throwable {
        st = System.currentTimeMillis();
    }
    @AfterReturning("execution(* com.ds.service.*Impl.*(..))")
    public void after() throws Throwable {
        ed = System.currentTimeMillis();
        long l = ed - st;
        System.out.println("共花费时间:"+l);
    }
}
